﻿imports System.Text 
Public Class clsviGroupUserRow
	inherits ADODBU.RowClass
	Private mVar_group_name As System.String
	Private mVar_group_id As System.String
	Private mVar_Users As System.String
	Private mVar_Dirtygroup_name As Boolean=false 
	Private mVar_Dirtygroup_id As Boolean=false 
	Private mVar_DirtyUsers As Boolean=false 
	Private mIsOnInit as Boolean 
	PUBLIC DataSource as ADODBU.Recordset 
	Public RowOrigin As clsviGroupUserRow
''[------------------------------------------------------------------------]'
	Public Sub New()
	RowOrigin=new clsviGroupUserRow(true)
	End Sub
''[------------------------------------------------------------------------]'
	Friend Sub New(lCut as boolean)
	 '--- untuk memutus loop reference 
	End Sub
	        ''[------------------------------------------------------------------------]'
	        ''' <summary>
	        ''' create new this class from inherited of this class or its self
	        ''' </summary>
	        ''' <param name="recdataRow"></param>
	        ''' <remarks></remarks>
	    Public Sub New(ByVal recdataRow As ADODBU.RowClass)
	        RowOrigin = New clsviGroupUserRow(True)
	        me.JoinValue(recdataRow)
	    End Sub
''[------------------------------------------------------------------------]'
	Public Sub New(recData as  ADODBU.Recordset)
	RowOrigin=new clsviGroupUserRow(true)
		DataSource = recData 
		try 
		InitVar( recdata.GetCurrentDataRow)
		Catch 
		end Try
	End Sub
 
''[------------------------------------------------------------------------]'
	Public Sub New(recdataRow as  DataRow)
	RowOrigin=new clsviGroupUserRow(true)
		InitVar( recdataRow)
	End Sub
 
#Region "Initialize vars "
''[------------------------------------------------------------------------]'
	private Sub InitVar(Fields as  DataRow)
		Try
			 mVar_group_name = Fields("group_name")
			 RowOrigin.group_name = mVar_group_name 
		Catch e as Exception
		End Try
		Try
			 mVar_group_id = Fields("group_id")
			 RowOrigin.group_id = mVar_group_id 
		Catch e as Exception
		End Try
		Try
            mVar_Users = Fields("KD_User")
            RowOrigin.Kd_User = mVar_Users
		Catch e as Exception
		End Try
	End Sub
 
 
#End Region 
''[------------------------------------------------------------------------]'
#Region "Properties"
		Public Property group_name As System.String
			Get
				Return mVar_group_name
			End Get
			Set(ByVal Value As System.String )
				mVar_group_name= Value 
				Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("group_name")) 
				IF Not mIsOnInit then 
					mVar_Dirtygroup_name= True
				End if 
			End Set
		End Property
		Public Property group_id As System.String
			Get
				Return mVar_group_id
			End Get
			Set(ByVal Value As System.String )
				mVar_group_id= Value 
				Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("group_id")) 
				IF Not mIsOnInit then 
					mVar_Dirtygroup_id= True
				End if 
			End Set
		End Property
    Public Property Kd_User() As System.String
        Get
            Return mVar_Users
        End Get
        Set(ByVal Value As System.String)
            mVar_Users = Value
            Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("Users"))
            If Not mIsOnInit Then
                mVar_DirtyUsers = True
            End If
        End Set
    End Property
		Public ReadOnly Property group_nameIsDirty As Boolean 
			Get
				Return mVar_Dirtygroup_name
			End Get
		End Property
		Public ReadOnly Property group_idIsDirty As Boolean 
			Get
				Return mVar_Dirtygroup_id
			End Get
		End Property
		Public ReadOnly Property UsersIsDirty As Boolean 
			Get
				Return mVar_DirtyUsers
			End Get
		End Property
#End Region 
''[------------------------------------------------------------------------]'
	Public Function SaveToDataSource() as string
		dim msgErr as string 
		msgErr ="Query" 
		return msgErr  
	End function
''[------------------------------------------------------------------------]'
	Public Sub ClearDirty
		 mVar_Dirtygroup_name = false
		 mVar_Dirtygroup_id = false
		 mVar_DirtyUsers = false
	End Sub
''[------------------------------------------------------------------------]'
	Public Sub SetDirty
		 mVar_Dirtygroup_name = true
		 mVar_Dirtygroup_id = true
		 mVar_DirtyUsers = true
	End Sub

End Class
